﻿@model GosWeb.Models.Form.BloodRelation
@{
    ViewBag.Title = "检查血缘关系";
}

    @Html.ValidationSummary()
@{
    if (Model.Biont1 == null)
    {
        goto end1;
    }
    else if (Model.Biont2 == null)
    {
        goto end1;
    }
}


<fieldset>
    <legend>血缘关系 (Blood Relation)</legend>
    <br />
    <div style="font-size:large">
        @if (Model.CommonAncestors.Count == 0)
        {
            <span>他们没有共同祖先.</span>
        }
        else
        {
            <span>他们有共同祖先:<br />
            </span>
            <span style="background-color: Yellow">编号：@Html.ActionLink(Model.CommonAncestors[0].BiontID, "Details", new { id = Model.CommonAncestors[0].BiontID })
            </span> 
            <span> 血统: @Model.CommonAncestors[0].GenesMidStr ,</span> <span>@Model.CommonAncestors[0].SexStr ,</span>  
            <span>生日: @Model.CommonAncestors[0].Birthday ,</span>
            <span>地址: @Model.CommonAncestors[0].Address.ToString()</span>
        }
    </div>   
    <br />
    <div>
        编号：<span>@Model.BiontID1</span> 品系:<span>@Model.Biont1.GenesMidStr</span>
        地址:<span>@Model.Biont1.Address.ToString()</span>
    </div>
    <br />
    <div>
        编号： <span>@Model.BiontID2</span> 品系: <span>@Model.Biont2.GenesMidStr</span>
        地址: <span>@Model.Biont2.Address.ToString()</span>
    </div>
</fieldset>
<p>
</p>
<fieldset>
    <legend>祖先树1 (Pedigree Tree 1)</legend>
    <ul id="PedigreeTree1"><img src='../../Content/Pic/float_loading.gif'></img>
        @Model.BiontID1 正在查找祖先...
    </ul>
</fieldset>
<fieldset>
    <legend>祖先树2 (Pedigree Tree 2)</legend>
    <ul id="PedigreeTree2"><img src='../../Content/Pic/float_loading.gif'></img>
        @Model.BiontID2 正在查找祖先...
    </ul>
</fieldset>
<script type="text/javascript">
    $(document).ready
    (    
        function () {
        
            $.get("/Biont/GetAncestorTree?layer=2&BID=" +  "@Model.BiontID1",
                { Action: "get" },
                function (data, textStatus) {
                    this;
                    //alert(data);
                    document.getElementById('PedigreeTree1').innerHTML = data;
                }
            );
            //-----------------
            
            $.get("/Biont/GetAncestorTree?layer=2&BID=" +  "@Model.BiontID2",
                { Action: "get" },
                function (data, textStatus) {
                    this;
                    //alert(data);
                    document.getElementById('PedigreeTree2').innerHTML = data;
                }
            );
        }
    ) 
</script>

@{
end1: ;
}